import React from 'react';
import Clock from './Clock';
import BodyChild from './bodyChild'
const defaultProps = {
    usernameTest: 'xiangzhengtest'
}
export  default class BodyIndex extends React.Component {
    constructor(){
        super();
        this.state = {
            username: '向征1',
            ChildData: ''
        }
    }
    changeInfo() {
        this.setState({
            username: '向春龙'
        })
    }
    handle(event) {
        console.log(event.target.value)
        this.setState({
            ChildData: event.target.value
        })
    }
    render(){
        var boolButton = false;
        return (
            <div>
                <h1>这是页面内容 :我的名字叫{ this.state.username }</h1>
                <p>父组件传过来的值{this.props.username} userid {this.props.userid}</p>
                <Clock time={ this.state.username }/>
                <p><input type="button" value='默认按钮' disabled={boolButton} onClick={this.changeInfo.bind(this)}/></p>
                <p>子组件input中的内容{this.state.ChildData}</p>
                <BodyChild handle={this.handle.bind(this)}/>
                <p>属性默认值{this.props.usernameTest}</p>
                <hr/>
            </div>
        )
    }
}
// 给属性默认值
BodyIndex.defaultProps = defaultProps;